<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>测试</title>
	<!--jquery-->
	<script type="text/javascript" src="jquery/jquery-1.8.3.min.js"/></script>
	<!--ztree-->
	<link href="jquery-ztree/3.5.19/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css"/>
	<script src="jquery-ztree/3.5.19/js/jquery.ztree.all-3.5.js" type="text/javascript"></script>
</head>

<script>
var setting = {
		data:{
			key:{
				name: "text",
    			url: null
			}
		}
};
var contextPath ="<%=request.getContextPath() %>";
$(document).ready(function(){
	jQuery.ajax({
		url:contextPath+"/test/ztree/nochild.do",
		dataType:'json',
		type:'post',
		success:function(zNodes){
			jQuery.fn.zTree.init($("#ztree1"), setting, zNodes);
		}
	});
	
	jQuery.ajax({
		url:contextPath+"/test/ztree/haschild.do",
		dataType:'json',
		type:'post',
		success:function(zNodes){
			jQuery.fn.zTree.init($("#ztree2"), setting, zNodes);
		}
	});
	
});
</script>

<div id="ztree1" class="ztree"></div>
<div id="ztree2" class="ztree"></div>